﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _061
{
    internal class Program
    {
        /// <summary>
        /// C # 变量和数据输入
        /// C#常用到的数据类型
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            #region
            /*
            Console.WriteLine("请输入您的姓名");
            string name = Console.ReadLine();
            Console.WriteLine("请输入您的年龄");
            int age = int.Parse(Console.ReadLine());
            Console.WriteLine("Hello World");
            */
            #endregion
            #region
            /*
            Console.WriteLine();
            Console.WriteLine("明星：","票价","GD","1000");
            Console.ReadKey();
            }
            */
            #endregion
            #region
            /*
            //交换数据
            int x = 30, y = 40, temp;
            Console.WriteLine("交换前：x={0},y={1}", x, y);
            //开始交换
            temp = x;
            x = y;
            y = temp;
            Console.WriteLine("交换后：x={0},y={1}", x, y);
            //判断语句
            Console.WriteLine("请输入你的国籍");
            string country = Console.ReadLine();
            if (country == "中国")
            {
                Console.WriteLine("欢迎您");
            }
            else
            {
                Console.WriteLine("您是哪国人？");
            }
            int i = 1;
            while(i<=8)
            {
                Console.WriteLine(i);
                i++;
            }
            int a = 1;
            do
            {
                Console.WriteLine(a);
                a++;

            } while (a <= 8);
            int sum = 0;
            for(int b=1;b<20;b++)
            {
                sum += i;
            }
            Console.WriteLine("1到20之间整数的和为：{0}",sum);
            */
            #endregion
            #region
            /*
            //计算从1到100之间的和
            int sum = 0;
            for(int i=1;i<=100;i++)
            {
                sum += i;//累加所有数的和
            }
            Console.WriteLine("1到100之间整数的和为：{0}",sum);
            //输出1到10的整数
            int a = 1;
            do
            {
                Console.Write(a);
                a++;
            } while (a <= 10);
            Console.WriteLine();
            int b = 1;
            do
            {
                Console.Write(b);
                b++;
            } while (b <= 11);
            Console.WriteLine();
            int c = 1;
            while(c<=12)
            {
                Console.Write(c);
                c++;
            }
            Console.WriteLine();
            int d = 1;
            do
            {
                Console.Write(d);
                d++;
            } while (d <= 13);
            Console.WriteLine();
            int e = 1;
            do
            {
                Console.Write(e);
                e++;
            } while (e <= 14);
            Console.WriteLine();
            int f = 1;
            while(f<=15)
            {
                Console.Write(f);
                f++;
            }
            Console.WriteLine();
            int sum1= 0;
            for(int g=1;g<=16;g++)
            {
                sum1 += g;
            }
            Console.WriteLine("1到16之间整数的和为：{0}",sum1);
            */
            #endregion
            #region
            /*

            //嵌套循环输出10行1-8之间的整数
            for (int i=1;i<=10;i++)//外循环，i控制行
            {
                for(int j=1;j<=8;j++)//内循环，j控制列
                {
                    Console.Write(j+"");//输出j
                }
                Console.WriteLine();//输出一样整数后再换行
            }
            
            for(int a = 1; a <= 10; a++)
            {
                for(int b=1;b<=10;b++)
                {
                    Console.Write(b + "");
                }
                Console.WriteLine();
            }
            for(int c=1;c<=5;c++)
            {
                for(int d=1;d<=c;d++)
                {
                    Console.Write("▲");
                }
                Console.WriteLine();
            }
            */
            #endregion

            /*
            //一维数组
            string[] lx = new string[5];
            for(int i=0;i<lx.Length;i++)
            {
                Console.WriteLine("请输入第{0}种军用飞机类型：",i+1);
                lx[i] = Convert.ToString(Console.ReadLine());
                Console.WriteLine("是否继续输入(y/n)?:");
                string a = Console.ReadLine();
                if(a=="n")
                {
                    Console.WriteLine("信息输入完毕");
                    break;
                }
            }
            */
            int sum = 0;
            int n = 10;
            int[] num = new int[n];
            for(int i=0;i<num.Length;i++)
            {
                Console.WriteLine("请输入第{0}个数：",i+1);
                num[i] = Convert.ToInt32(Console.ReadLine());
                sum = sum + num[i];
            }
            Console.WriteLine("\n您输入的数之和为："+sum);
            Console.WriteLine("您输入的数的平均值为："+(sum*1.0/num.Length));
            Console.ReadKey();
        }
    }
}
